import os
import sys
file_exec_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.insert(0, file_exec_path)
import unittest
import redis

from framework_strategy.gopy.gateways.adapter import InterfaceCacheData


class TestBinanceGateway(unittest.TestCase):

    @unittest.skip
    def test_redis(self):
        pool = redis.ConnectionPool(
            host='127.0.0.1',
            password='',
            port='7006',
            db=0
        )
        self._cursor = redis.Redis(connection_pool=pool, max_connections=10)
        print(self._cursor.get('binance:btc_usdt:depth'))

    def test_depth(self):
        icd = InterfaceCacheData()
        print(icd.get('binance', 'depth', 'btc_usdt'))

    # @unittest.skip
    # def test_depth(self):
    #     depth = DepthCacheData()
    #     print('binance depth', depth.get('binance', 'btc_usdt'))

    # @unittest.skip
    # def test_ticker(self):
    #     ticker = TickerCacheData()
    #     print(ticker.get('ftx', 'btc_usdt'))
    
    # @unittest.skip
    # def test_trade(self):
    #     trade = TradeCacheData()
    #     print(trade.get('ftx', 'btc_usdt'))

    # def test_asc(self):
    #     ticker = TickerCacheData()
    #     print(ticker.get('ftx', 'btc_usdt'))
    #     test()
    

if __name__ == '__main__':
    '''
    register 
        url相当于注册列表, request会进行查找方法调用
        根据请求，检查注册列表判断是否进行适配(redis)        
    '''
    unittest.main()
